﻿using D20.Entities.Characters;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using D20.Entities.Items;
using System.Collections.Generic;

namespace D20.UnitTests.Characters
{


    /// <summary>
    ///This is a test class for CreatureTest and is intended
    ///to contain all CreatureTest Unit Tests
    ///</summary>
    [TestClass()]
    public class CreatureTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Attitude
        ///</summary>
        [TestMethod()]
        [DeploymentItem("D20.dll")]
        public void AttitudeTest()
        {
            Creature c = CreateCreature();
            c.Attitude.Alignment.Lawful = Alignment.MaxAlignment;
            c.Attitude.Alignment.Good = 1;

            Alignment a = new Alignment(Alignment.MaxAlignment, 1);
            Assert.AreEqual(a, c.Attitude.Alignment);

        }

        /// <summary>
        ///A test for Minions
        ///</summary>
        [TestMethod()]
        [DeploymentItem("D20.dll")]
        public void MinionsTest()
        {
            Creature c = CreateCreature();
            PlayerCharacter pc = new PlayerCharacter();
            pc.MaxHealth = 1234;
            pc.Health = 1234;
            c.Minions.Add(pc);
            Assert.IsTrue(c.Minions.Contains(pc));
        }

        /// <summary>
        ///A test for PersonalInventory
        ///</summary>
        [TestMethod()]
        [DeploymentItem("D20.dll")]
        public void PersonalInventoryTest()
        {
            Creature c = CreateCreature();
            Item i = new Item();
            i.MaxHealth = 150;
            i.Health = 149;
            c.PersonalInventory.AddItem(i);
            Assert.IsTrue(c.PersonalInventory.Contents.Contains(i));
        }

        internal virtual Creature_Accessor CreateCreature_Accessor()
        {
            // TODO: Instantiate an appropriate concrete class.
            Creature_Accessor target = null;
            return target;
        }
        private Creature CreateCreature()
        {
            return new Monster();
        }
        /// <summary>
        ///A test for SkillSet
        ///</summary>
        [TestMethod()]
        [DeploymentItem("D20.dll")]
        public void SkillSetTest()
        {
            Creature c = CreateCreature();
            Skill s = new Skill(SkillType.Search, 1);
            c.SkillSet.Skills.Add(s);
            bool found = c.SkillSet.Skills.Contains(s);
            Assert.IsTrue(found, "Could not find skill.");
        }
    }
}
